
 package com.ami.kvm.jviewer.gui;
 
 import java.awt.event.ActionListener;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Set;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
 import javax.swing.KeyStroke;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 public class JVPopupMenu
   extends JPopupMenu
 {
   public static final String CUT = "Cut";
   public static final String COPY = "Copy";
   public static final String PASTE = "Paste";
   protected HashMap<String, Object> popupMenuItems;
   
   public JVPopupMenu()
   {
     this.popupMenuItems = new HashMap();
   }
   
 
 
 
 
 
 
   public void addMenuItem(String paramString1, String paramString2, char paramChar, KeyStroke paramKeyStroke)
   {
     add(createMenuItem(paramString1, paramString2, paramChar, paramKeyStroke));
   }
   
 
 
 
 
 
 
   public void addMenuItem(String paramString1, String paramString2, char paramChar, int paramInt, KeyStroke paramKeyStroke)
   {
     add(createMenuItem(paramString1, paramString2, paramChar, paramKeyStroke), paramInt);
   }
   
 
 
   public void addMenuItemSeparator()
   {
     addSeparator();
   }
   
 
 
 
 
 
 
 
   private JMenuItem createMenuItem(String paramString1, String paramString2, char paramChar, KeyStroke paramKeyStroke)
   {
     JMenuItem localJMenuItem = new JMenuItem(paramString1);
     localJMenuItem.setActionCommand(paramString2);
     localJMenuItem.setMnemonic(paramChar);
     localJMenuItem.setAccelerator(paramKeyStroke);
     this.popupMenuItems.put(paramString2, localJMenuItem);
     return localJMenuItem;
   }
   
 
 
   public void createEditPopup()
   {
     addMenuItem(LocaleStrings.getString("AI_1_JVPM"), "Cut", ' ', KeyStroke.getKeyStroke(88, 2));
     
     addMenuItem(LocaleStrings.getString("AI_2_JVPM"), "Copy", ' ', KeyStroke.getKeyStroke(67, 2));
     
     addMenuItem(LocaleStrings.getString("AI_3_JVPM"), "Paste", ' ', KeyStroke.getKeyStroke(80, 2));
   }
   
 
 
 
 
   public void addActionListener(ActionListener paramActionListener)
   {
     Set localSet = this.popupMenuItems.keySet();
     Iterator localIterator = localSet.iterator();
     
     while (localIterator.hasNext()) {
       JMenuItem localJMenuItem = (JMenuItem)this.popupMenuItems.get(localIterator.next());
       if (localJMenuItem != null) {
         localJMenuItem.addActionListener(paramActionListener);
       }
     }
   }
   
 
 
 
   public JMenuItem getMenuItem(String paramString)
   {
     return (JMenuItem)this.popupMenuItems.get(paramString);
   }
   
 
 
   public void enableAll()
   {
     Set localSet = this.popupMenuItems.keySet();
     Iterator localIterator = localSet.iterator();
     
     while (localIterator.hasNext()) {
       JMenuItem localJMenuItem = (JMenuItem)this.popupMenuItems.get(localIterator.next());
       if (localJMenuItem != null) {
         localJMenuItem.setEnabled(true);
       }
     }
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\kvm\jviewer\gui\JVPopupMenu.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */